#!/usr/bin/env ruby -w
#--
# Project:      pkgman
# File:         test/serve_pkgs.rb
# Revision:     $Id$
# Home:         http://code.google.com/p/pkgman/
# Author:       Derek Olsen <someword at gmail dot com>
# Copyright:    (c) 2007 by Derek Olsen
# License:      GNU General Public License v2 
#++

# This script is used to serve up pkgs during testing.

require 'webrick'
include WEBrick

# Where are the pkgs located
pkg_dir = File.join(File.dirname(__FILE__), "/", "pkgs")

# DEfine the server 
s = HTTPServer.new(:Port => 1080)

# Mount up the pkgs dir
s.mount('/pkgs',	HTTPServlet::FileHandler, pkg_dir)


# Handle signals
['TERM', 'INT'].each do |signal|
  trap(signal){ s.shutdown }
end

# Start the server
s.start
